package com.chang.ware.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chang.ware.entity.WareSkuEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 商品库存
 * 
 * @author chang
 * @email 2045807586@qq.com
 * @date 2024-01-03 16:01:52
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    void addStock(@Param("purchaseId") Long purchaseId, @Param("wareId") Long wareId, @Param("skuNum") Integer skuNum);

    // 获取商品库存
    Integer CountStock(Long skuIds);

    // 锁定商品库存
    Long lockSkuStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("skuCount") Integer skuCount);

    // 解锁商品库存
    void unlockStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("skuNum") Integer skuNum);
}
